Skip to content

Upload the unit test coverage to Codacy - #157

Merged
PDowney merged 3 commits into
mainfrom
codacy-coverage
Nov 24, 2026
Merged

PDowney merged 3 commits into
mainfrom
codacy-coverage

Conversation

@PDowney

@PDowney PDowney commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

Send the unit test coverage to Codacy.

Why

The unit-coverage job wrote clover.xml but never uploaded it, so Codacy's coverage for this repository stopped. No workflow ever uploaded it.

What changes

A new step in the unit-coverage job, after the line-coverage check:

  • Pinned reporter: downloads Codacy's coverage reporter 14.1.3 from its GitHub release and checks it against a SHA-512 written in the workflow. Codacy's GitHub Action is not used: its last release was in January 2022, and it fetches the reporter script from a master branch on every run.
  • Upload: sends clover.xml for the commit Codacy analyzes, which on a pull request is the head commit, not GitHub's merge commit. It reads the repository token from the CODACY_PROJECT_TOKEN secret.
  • When it runs: on pushes and on pull requests from branches in this repository. Dependabot's and forks' pull requests get no secrets, so they skip the upload.
  • Failures: a failed upload fails the job on pushes, and the job's issue names the upload_coverage stage; the issue template explains what that stage means. On a pull request, the failure is reported without blocking the merge.

Dependabot cannot update the reporter. A weekly workflow in EngineScript/EngineScript checks the pinned version in all five repositories and files an issue when a newer release is out.

Verification

  • actionlint, yamllint, the workflow schema, checkov, markdownlint, ShellCheck on the new step's script, and gitleaks pass. zizmor's default level reports nothing new.
  • This pull request's own run is the first upload. Codacy should show its head commit's coverage.

🤖 Generated with Claude Code

The unit-coverage job wrote clover.xml but never sent it, so Codacy
showed no coverage. The job now downloads Codacy's coverage reporter
14.1.3, checks it against its SHA-512, and uploads the report for the
commit Codacy analyzes (a pull request's head commit). It reads the
repository token from the CODACY_PROJECT_TOKEN secret. Dependabot's and
forks' pull requests skip the upload; a failed upload fails the job on
pushes and is reported without blocking a pull request.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for contributing to Optimizations ACE MC!

Before we review:

  • Have you tested your changes with WordPress 7.0+?
  • Are your changes compatible with PHP 8.3+?
  • Have you followed WordPress coding standards?
  • Did you update the CHANGELOG.md if needed?

Security Reminder
This plugin changes WooCommerce, WP Store Locator, and WordPress admin screens, so please ensure:

  • All user input is properly sanitized
  • All output is properly escaped
  • No security vulnerabilities are introduced

We'll review your PR soon.

@codacy-production

codacy-production Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Coverage ∅ diff coverage

Metric Results
Coverage variation Report missing for 7f79abd1
Diff coverage ✅ ∅ diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (7f79abd) Report Missing Report Missing Report Missing
Head commit (1f5e0e9) 263 238 90.49%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#157) 0 0 ∅ (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

1 Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

PDowney and others added 2 commits November 24, 2026 03:11
The coverage issue template sent readers to Settings > Coverage.
Codacy creates repository API tokens under the repository's
Settings > API tokens, shows each one once, and expires it within a year.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
curl followed redirects to any protocol (SonarCloud S6506). The
reporter download now uses --proto '=https', which also limits the
redirects curl follows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@PDowney
PDowney merged commit 7d7fcc8 into main Nov 24, 2026
28 checks passed
@github-actions
github-actions Bot deleted the codacy-coverage branch November 24, 2026 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant